<?php
class Apps_View_Helper_StrLimit extends Zend_View_Helper_Abstract {
    protected $_defaultLength = 255;
    protected $_defaultOffset = 0;

	public function getDefaultLength() { return $this->_defaultLength; }
	public function setDefaultLength($defaultLength) { $this->_defaultLength = $defaultLength; return $this; }
    public function getDefaultOffset() {return $this->_defaultOffset; }
    public function setDefaultOffset($defaultOffset) { $this->_defaultOffset = $defaultOffset; return $this; }
	
	
	public function strLimit($str, $length=null, $offset=null) {
		if($length === null) { $length = $this->_defaultLength; }
		if($offset === null) { $offset = $this->_defaultOffset; }
		
		return substr($str, $offset, $length);
	}
}